
#include <stdio.h>
#include "SM3.h"

int main() {
    char message1[] = "Hello, World!";
    char message2[] = "This is a test message.";
    unsigned char hash1[32], hash2[32];

    // 计算第一个消息的哈希值
    SM3_256((unsigned char *)message1, strlen(message1), hash1);

    // 计算第二个消息的哈希值
    SM3_256((unsigned char *)message2, strlen(message2), hash2);

    // 打印哈希值
    printf("Hash value of '%s': ", message1);
    for (int i = 0; i < 32; i++) {
        printf("%02x", hash1[i]);
    }
    printf("\n");

    printf("Hash value of '%s': ", message2);
    for (int i = 0; i < 32; i++) {
        printf("%02x", hash2[i]);
    }
    printf("\n");

    // 进行自我测试
    int testResult = SM3_SelfTest();
    if (testResult == 0) {
        printf("SM3 calculation is correct.\n");
    } else {
        printf("SM3 calculation is wrong.\n");
    }

    return 0;
}
